const menu = {
  id: "1",
  title: "XDR3.0",
  active: "01",
  children: [
    {
      // pid: '1',
      id: "01",
      title: "xdr",
      active: "01-01",
      children: [
        {
          // pid: '01',
          id: "01-01",
          title: "告警",
          active: "01-01-01",
          children: [
            {
              // pid: '01-01',
              id: "01-01-01",
              title: "告警",
              active: "01-01-01",
              children: [
                {
                  // pid: '01-01-01',
                  id: "01-01-01-01",
                  title: "列表",
                  path: "/xdr#/alarm/overview",
                },
                {
                  // pid: '01-01-01',
                  id: "01-01-01-02",
                  title: "概况",
                  path: "/xdr#/alarm/overview",
                },
              ],
            },
          ],
        },
      ],
    },
  ],
};

const getCurrentMenu = (menu, level) => {
  if (level > 1) {
    level--;
    const nextMenu = menu.children.find((item) => item.id == menu.active);
    return getCurrentMenu(nextMenu, level);
  } else {
    return menu;
  }
};
